package com.zhu.transaction.mapper.imp;

import com.zhu.transaction.mapper.MessageMapper;
import com.zhu.transaction.pojo.Message;
import com.zhu.transaction.pojo.state.BackState;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zhuzhu
 * @createtime 2021/3/4-9:51
 */
@Repository
public class MessageMapperImp implements MessageMapper {
    @Autowired
    SqlSession sqlSession;


    @Override
    public int addOneMessage(Message message) {
        return sqlSession.getMapper(MessageMapper.class).addOneMessage(message);
    }

    @Override
    public int updateMessageState(String messageId, Integer newState) {
        return sqlSession.getMapper(MessageMapper.class).updateMessageState(messageId, newState);
    }

    @Override
    public List<Message> queryMessageByReceiveUserId(String userId) {
        return sqlSession.getMapper(MessageMapper.class).queryMessageByReceiveUserId(userId);
    }

    @Override
    public Integer unReadMessageCount(String userId) {
        return sqlSession.getMapper(MessageMapper.class).unReadMessageCount(userId);
    }

    @Override
    public int deleteOneMessage(String messageId) {
        return sqlSession.getMapper(MessageMapper.class).deleteOneMessage(messageId);
    }
}
